<extend name="Public/base" />

<block name="content">
<div id="content">
	<div id="content-header">
		<div id="breadcrumb">
			<a href="{:U('Index/index')}" title="首页" class="tip-bottom"><i
				class="icon-home"></i> 首页</a> <a href="{:U('Auth/department')}"
				class="current">{$meta_title}</a> <a class="current">{$meta_title_c}</a>
		</div>
	</div>
	<div class="container-fluid">
		<br>
		<div class="row-fluid">
			<div class="span12">
				<div class="widget-box">
					<form action="" method="post" class="form-horizontal">
						<div class="control-group">
							<label class="control-label">上级部门 :</label>
							<div class="controls">
								<input type="text" class="ui-wizard-content span5" disabled="disabled" value="{$father_info['department_name']|default='无'}" />
							</div>
						</div>
						<div class="control-group">
							<label class="control-label">部门名称:</label>
							<div class="controls">
								<input type="text" class="ui-wizard-content span5"
									placeholder="名称不能为空" name="department_name" value="{$info.department_name|default=''|change_str}" />
							</div>
						</div>
					
						<div class="control-group">
							<label class="control-label">排序 :</label>
							<div class="controls">
								<input type="text" class="ui-wizard-content span2"
									placeholder="例如：0" name="sort" value="{$info.sort|default='0'}" onkeyup="value=value.replace(/[a-zA-z]+$/,'')" />
							</div>
						</div>
												
						<div class="control-group">
							<label class="control-label">部门简介 :</label>
							<div class="controls">
								<textarea class="ui-wizard-content span5" placeholder="部门简介" style="resize: none; height: 100px;" name="description">{$info.description|default=''|change_str}</textarea>
							</div>
						</div>
						
						<div class="form-actions">
							<input type="hidden" name="id" value="{$info.id|default=''}">
							<input type="hidden" name="father_id" value="{:isset($father_info['id'])?$father_info['id']:$info['pid']}">
							<input type="hidden" name="level" value="{$info['level']|default='0'}">
							<button type="button" class="btn btn-success" id="submit">保 存</button>
							<button type="button" class="btn btn-danger" onclick="javascript:history.go(-1);return false;">返 回</button>
						</div>
					</form>
				</div>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript">
$(function(){
	$("#submit").click(function(){
		//锁定提交按钮
		$(this).attr('disabled',true);
		var self = $('form');
		$.post("{$post_url}", self.serialize(), call_back, "json");
		return false;
		/**
		 * @todo 接收登录返回值
		 */
		function call_back(data){
			if(data.status == 1){
				tke_alert(data.info,'alert-success');
				setTimeout(function(){
					window.location.href = data.url;
				},1000);
			} else {
				tke_alert(data.info,'alert-error');
				$("#submit").attr('disabled',false);
			}
		}
	});
/* 	//控件 默认值
	set_value("allow_publish", {$info.allow_publish|default=0});
	set_value("check", {$info.check|default=0}); */
});
highlight_subnav('{:U('Auth/department')}');
</script>
</block>
